home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Day Cry
/
Day Cry CD.bin
/
oh_towns
/
fjcha
/
omake
/
sc.asm
next >
Wrap
Assembly Source File
|
1994-09-20
|
5KB
|
240 lines
;*************************************************
;* *
;* âX âN âì ü[ âï âT âô âv âï *
;* *
;* 1994. 9. 10 by é┐éσéαéτé±é▄ *
;* *
;*************************************************
.386
;*************** âZâOâüâôâgè╓îW ****************
VRAM2 equ 0104h
TBIOS equ 0110h
;*************** ânü[âhâEâFâAè╓îW ****************
DotsInByte equ 2
ScreenMaxX equ 1024
ScreenMaxY equ 511
LineSize equ ScreenMaxX / DotsInByte
;*************** éaéhénérè╓îW ****************
EndProcess equ 4ch
EGB_workSize equ 1536
EGB equ 20h
EGB_resolution equ 01h
NormalMode equ 03h
MOS_workSize equ 4096
MOS equ 40h
MOS_entry equ 48h
ON equ 1
OFF equ 0
MOS_start equ 00h
MOS_end equ 01h
MOS_disp equ 02h
MOS_rdpos equ 03h
LeftButton equ 01h
RightButton equ 02h
;******************** é╗é╠æ╝ *********************
ScrollAreaX equ 500
ScrollAreaY equ 300
;***************** âÅü[âNâGâèâA ******************
assume ds:data
data segment
EGB_work db EGB_workSize dup( ? )
MOS_work db MOS_workSize dup( ? )
refuge db LineSize dup( ? )
data ends
assume cs:code
code segment
main proc
mov ax , TBIOS
mov fs , ax
mov ax , ds
mov gs , ax
;*---------------- ëµû╩Åεò±É▌ÆΦ ------------------
mov ah , EGB_resolution
mov al , 0
mov dx , NormalMode
mov edi , offset EGB_work
call pword ptr fs:[ EGB ]
;*------------- â}âEâXéaéhénérïNô« ---------------
mov ah , MOS_start
mov ecx , MOS_workSize
mov edi , offset MOS_work
call pword ptr fs:[ MOS ]
;*------------- â}âEâXâJü[â\âïò\Ī ---------------
mov ah , MOS_disp
mov al , ON
call pword ptr fs:[ MOS ]
;***************** âüâCâôâïü[âv ******************
#main_loop:
;*------- â}âEâXé╠ê╩Æué╞â{â^âôé╠ô╟é▌ĵéΦ ---------
call pword ptr fs:[ MOS_entry ]
mov ah , MOS_rdpos
call pword ptr fs:[ MOS ]
call mystery
;*-------------- ëEâ{â^âôé╠â`âFâbâN --------------
test ch , RightButton
jnz short #finish
;*-------------- ì╢â{â^âôé╠â`âFâbâN --------------
test ch , LeftButton
jz short #main_loop
;*----------------- âXâNâìü[âï -------------------
movsx edx , dx ; 32bitë╗
movsx ebx , bx
and edx , 0fffffffeh ; ï⌠Éöë╗
and ebx , 0fffffffeh
call scroll
jmp short #main_loop
;-------------- â}âEâXéaéhénérÅIù╣ ---------------
#finish:
mov ah , MOS_end
call pword ptr fs:[ MOS ]
mov ah , EndProcess
int 21h
main endp
;*------------------- ü`ôΣü` ---------------------
mystery proc
push fs
push eax
push dword ptr VRAM2
pop fs
shrd eax , edx , 4
shrd eax , edx , 4
shrd eax , edx , 4
shrd eax , edx , 4
shrd eax , edx , 4
shrd eax , edx , 4
shrd eax , edx , 4
shrd eax , edx , 4
mov fs:[0 ],eax
mov fs:[LineSize ],eax
mov fs:[LineSize*2],eax
mov fs:[LineSize*3],eax
mov fs:[LineSize*4],eax
pop eax
pop fs
ret
mystery endp
;****************** âXâNâìü[âï *******************
;*------------------ êΩìsô]æù --------------------
linetrans proc
push ecx
push esi
push edi
rep movsd
pop edi
pop esi
pop ecx
ret
linetrans endp
scroll proc
push gs
push fs
push es
pushad
;*------ ëµû╩é⌐éτé═é▌Åoé╡é─éóé╚éóé⌐â`âFâbâN ------
cmp edx , ScreenMaxX - ScrollAreaX
jbe short #x_ok
mov edx , ScreenMaxX - ScrollAreaX
#x_ok:
cmp ebx , ScreenMaxY - ScrollAreaY
jbe short #y_ok
mov ebx , ScreenMaxY - ScrollAreaY
#y_ok:
;*------------ âîâWâXâ^é╠Ælé≡É▌ÆΦ ----------------
; EDI <= EBX * LineSize + EDX / 2
; ESI <= ( EBX + 1 ) * LineSize + EDX / 2
; ECX <= ScrollAreaX / 4
shr edx , 1
imul ebx , LineSize
lea edi , [ ebx + edx ]
mov esi , edi
add esi , LineSize
mov ecx , ScrollAreaX / 8
;*----------------- ì┼ÅπÆié≡æ▐ö≡ -----------------
push ds
mov ax , ds
mov es , ax
mov ax , VRAM2
mov ds , ax
push edi
mov edi , offset refuge
call LineTrans
pop edi
;*------------------ âXâNâìü[âï ------------------
mov ax , VRAM2
mov es , ax
mov ebx , ScrollAreaY
#scrolling_loop:
call LineTrans
add edi , LineSize
add esi , LineSize
dec ebx
jnz short #scrolling_loop
;*----------------- ì┼ÅπÆié≡ò£ïA -----------------
pop ds
mov esi , offset refuge
call LineTrans
popad
pop es
pop fs
pop gs
ret
scroll endp
code ends
;***************** âXâ^âbâNÉ▌ÆΦ ******************
assume ss:stack
stack segment stack
db 2000 dup( ? )
stack ends
end main